package com.oa.android.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.oa.android.R;
import com.oa.android.entry.Fjian;

import java.util.List;

/**附件适配器
 * Created by zouqh on 2016/6/13.
 */
public class FujAdapter extends BaseAdapter {

    private Context context;
    private List<Fjian> list;

    public FujAdapter(Context contexts, List<Fjian> list){
        this.context=contexts;
        this.list=list;
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHodler viewHodler;
        if (convertView==null) {
            viewHodler = new ViewHodler();
            convertView = LayoutInflater.from(context).inflate(R.layout.text, null);
            viewHodler.name=(TextView)convertView.findViewById(R.id.name);
            convertView.setTag(viewHodler);
        }else {
            viewHodler= (ViewHodler) convertView.getTag();
        }
        viewHodler.name.setText(list.get(position).getOLDNAME());

        return convertView;
    }

    class ViewHodler{
        TextView name;
    }
}
